#ifndef _FXFM_FONTEX_H_
#define _FXFM_FONTEX_H_

#ifndef _FXFM_CODEPAGE_H_
	#include "fxfm_codepage.h"
#endif

//*****************************************************************************
//* Log Font
//*****************************************************************************
class CFXFM_LogFont : public CFX_Object
{
public:
	CFXFM_LogFont()
		: m_Charset(FXFM_CHARSET_Default)
		, m_bItalic(0)
		, m_wWeight(0)
		, m_dwFlag(0)
		, m_bsFamily("")

	{
			
	}

	CFXFM_LogFont(const CFXFM_LogFont& font)
		: m_Charset(font.m_Charset)
		, m_bItalic(font.m_bItalic)
		, m_wWeight(font.m_wWeight)
		, m_dwFlag(font.m_dwFlag)
		, m_bsFamily(font.m_bsFamily)
	{

	}
	CFXFM_LogFont(FX_BYTE Charset, FX_BYTE bItalic, FX_WORD wWeight, FX_DWORD dwFlag, CFX_ByteString bsFamily)
		: m_Charset(Charset)
		, m_bItalic(bItalic)
		, m_wWeight(wWeight)
		, m_dwFlag(dwFlag)
		, m_bsFamily(bsFamily)
	{

	};

	FX_BYTE			m_Charset;
	FX_BYTE			m_bItalic;
	FX_WORD			m_wWeight;
	FX_DWORD		m_dwFlag;
	CFX_ByteString	m_bsFamily;
};
typedef CFX_ObjectArray<CFXFM_LogFont>		CFXFM_LogFontArray;

//*****************************************************************************
//* font Mapper
//*****************************************************************************
class IFXFM_FontMapper
{
public:
	virtual void				Release() = 0;

	virtual void				MapFont(const CFXFM_LogFont* pFont, CFXFM_LogFontArray& CandidateList) = 0;
};

IFXFM_FontMapper* FXFM_CreateWindowsFontMapper();
IFXFM_FontMapper* FXFM_CreateLinuxFontMapper();

//*****************************************************************************
//* font manger
//*****************************************************************************
class IFXFM_FontMgr
{
public:
	virtual void				Release() = 0;
		
	virtual void				LoadInstalledFonts() = 0;

	virtual FXFT_Face			GetFileFace(IFX_FileStream* pStream, FX_INT32 faceIndex) = 0;
	virtual FXFT_Face			GetFixedFace(FX_LPCBYTE pData, FX_DWORD size, FX_INT32 faceIndex) = 0;
	virtual FX_BOOL				ReleaseFace(FXFT_Face pFace) = 0;

	virtual FXFT_Face			FindSubstitution(FX_BSTR face_name, FX_BOOL bTrueType, FX_DWORD flags, 
												FX_WORD weight, FX_INT32 italic_angle, int charsetCP, CFX_SubstFont* pSubstFont) = 0;

	virtual FXFT_Face			FindSubstitution(CFXFM_LogFont* pLogFont, FX_BOOL bTrueType, CFX_SubstFont* pSubstFont) = 0;
};

IFXFM_FontMgr*		FXFM_CreateFontManager(IFX_FileCollection* pExtFontCollection = NULL, FX_BOOL bExtCollectionOnly = FALSE, IFXFM_FontMapper* pExtFontMapper = NULL);

#endif//_FXFM_FONTEX_H_